#import "KFMovieController.h"

#import "KFConstants.h"

#import "KFActorView.h"
#import "KFMovie.h"
#import "KFActor.h"
#import "KFMovieView.h"
#import "KFAnimationHelper.h"

@implementation KFMovieController
@synthesize view;
@synthesize animationHelper;

-(void) awakeFromNib
{
    // bind the view to the actorsController
    
    self.animationHelper = [KFAnimationHelper animationHelper];
    
}

-(IBAction) onNewActor:(id)sender
{
    KFMovie *movie = self.content;
    
    KFActor *actor = [[[KFActor alloc] init] autorelease];
    [actorsController addObject:actor];
    
    // Hack
    KFActorView *actorView = [[[KFActorView alloc] initWithFrame:KFRectMake(10, 10, 100, 100) ] autorelease];    
    [actorView setWantsLayer:YES];
    actorView.actor = actor;
    actor.viewObject = actorView;     
    
    [self.animationHelper addView:actorView];    
    [self.view addSubview:actorView];    
}

- (void) dealloc
{
    self.animationHelper = nil;
    [super dealloc];
}

@end
